#include <iostream>
#include <cstring>
using namespace std;
//-----基类的定义
class Student
{
private:
  int stdno;
  char name[20];
  int age;
  char classname[20];
  char schoolname[20];

public:
  //构造函数
  Student(int stdno, char name[], int age, char classname[], char schoolname[])
  {
    this->stdno = stdno;
    strcpy(this->name, name);
    this->age = age;
    strcpy(this->classname, classname);
    strcpy(this->schoolname, schoolname);
  }

  void show()
  {
    cout << stdno << "\t";
    cout << name << "\t";
    cout << age << "\t";
    cout << classname << "\t";
    cout << schoolname << "\t";
  }
};

class CollegeStudent : public Student //派生类，本科生，公有继承
{
private:
  char classteacher[20];

public:
  //构造函数
  CollegeStudent(int stdno, char name[], int age, char classname[], char schoolname[], char classteacher[]) : Student(stdno, name, age, classname, schoolname)
  {
    strcpy(this->classteacher, classteacher);
  }

  void show()
  {

    Student::show();
    cout << classteacher << endl;
  }
};

//---------GraduatedStudent
class GraduatedStudent : public CollegeStudent //派生类，硕士，公有继承
{
private:
  char tutor[20];       //导师
  char projectname[50]; //课题
public:
  //构造函数
  GraduatedStudent(int stdno, char name[], int age, char classname[], char schoolname[], char classteacher[], char tutor[], char projectname[]) : CollegeStudent(stdno, name, age, classname, schoolname, classteacher)
  {
    strcpy(this->tutor, tutor);
    strcpy(this->projectname, projectname);
  }

  void show()
  {
    CollegeStudent::show();
    cout << tutor << "\t";
    cout << projectname << endl;
  }
};

//-----------------DoctorStudent--------------------
class DoctorStuden : public GraduatedStudent //派生类，博士，公有继承
{
private:
  char researchname[50];

public:
  DoctorStuden(int stdno, char name[], int age, char classname[], char schoolname[], char classteacher[],
  char tutor[], char projectname[],char researchname[]):GraduatedStudent(stdno,name,age,classname,schoolname,classteacher,tutor,projectname)
  {
    strcpy(this->researchname, researchname);
  }
  void show()
  {
    GraduatedStudent::show();
    cout << researchname << endl;
  }
};

//----------主函数
int main()
{
  int stdno;
  char name[20];
  int age;
  char classname[20];
  char schoolname[20];
  cout << "input the information of student:" << endl;
  cout << "stdno name age classname schoolname:\n";
  cin >> stdno >> name >> age >> classname >> schoolname;
  //定义学生类对象，初始化信息
  Student student1(stdno, name, age, classname, schoolname);
  cout << "the information of student is:" << endl;
  student1.show();
  //输入大学生的班主任
  char classteacher[20];
  cout << "input classteacher" << endl;
  cin >> classteacher;
  //定义大学生类对象
  CollegeStudent student2(stdno, stdno, name, age, classname, schoolname, classteacher);
  cout << "the information of student2 is:" << endl;
  student2.show();

  return 0;
}
